<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
foo();  // 2
var foo = function (){
    console.log("1");
}
foo();  // 1
function foo(){
    console.log("2");
}
foo();  // 1
</script>
</body>
</html>